<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>商品添加</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no">
  <link rel="stylesheet" href="${s.base}/js/layui/css/layui.css" media="all" />
  <link rel="stylesheet" href="${s.base}/css/base/base.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form" style="width:80%;">
  <input type="hidden" id="id" name="id" value="${item.id}" />
  <!-- <input type="hidden" id="catId" name="catId" value="${itemCat.id}" /> -->

  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">分类名称</label>
    <div class="layui-input-block">
      <select class="form-control"  id="catId">
        <#list itemCatList as itemCatInfo>
          <option value="${itemCatInfo.id}" <#if itemCatInfo.id==itemCat.id  >selected</#if> >${itemCatInfo.name}</option>
        </#list>
      </select>
    </div>
  </div>

  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">商品名称</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input name" id="title" name="title" value="${item.title}" placeholder="请输入商品名称" maxlength="30" lay-verify="required">
    </div>
  </div>

  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">商品价格</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input name" id="price" name="price" value="${item.price}" placeholder="请输入商品价格" maxlength="30" lay-verify="required|number">
    </div>
  </div>

  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">商品人次</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input name" id="personNum" name="personNum" value="${item.personNum}" placeholder="请输入商品人次" maxlength="30" lay-verify="required|number">
    </div>
  </div>

  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">最小购买数</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input name" id="minPurchaseNum" name="minPurchaseNum" value="${item.minPurchaseNum}" placeholder="请输入最小购买数" maxlength="30" lay-verify="required|number">
    </div>
  </div>

  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">转让价格</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input name" id="transferPrice" name="transferPrice" value="${item.transferPrice}" placeholder="请输入转让价格" maxlength="30" lay-verify="required|number">
    </div>
  </div>

  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">商品类型</label>
    <div class="layui-input-block">
      <input type="radio" name="type" value="1" title="商品" lay-filter="type" <#if !(item.type?if_exists&&item.type=='2')>checked</#if>>
      <input type="radio" name="type" value="2" title="虚拟物品" lay-filter="type" <#if item.type?if_exists&&item.type=='2'>checked</#if>>
    </div>
  </div>

  <div class="layui-form-item layui-row layui-col-xs12" id="redeemCodeShow" <#if item.type?if_exists&&item.type=='1'>style="display: none"</#if>>
    <label class="layui-form-label">兑换码</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input name" id="redeemCode" name="redeemCode" value="${item.redeemCode}" placeholder="请输入兑换码" maxlength="30" lay-verify="required|number">
    </div>
  </div>

    <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">图片一</label>
    <div class="layui-input-block">
      <div class="famous-upload-pic">
        <img  <#if item.imageOne?if_exists  >src="${item.imageOne}"<#else>src="${s.base}/image/icon_addpic.png"</#if> class="upload-avatar" id="upload-image-one"/>
        <input type="file" name="myfiles" class="upload" id="myFile" onchange="ajaxFileUploads('myFile','imageOne','upload-image-one')">
        <input type="hidden" class="imageOne" id="imageOne" <#if item.imageOne?if_exists  > value="${item.imageOne}"  <#else> value="/image/icon_addpic.png" </#if> />
      </div>
    </div>
  </div>

  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">图片二</label>
    <div class="layui-input-block">
      <div class="famous-upload-pic">
        <img  <#if item.imageTwo?if_exists  >src="${item.imageTwo}"<#else>src="${s.base}/image/icon_addpic.png"</#if> class="upload-avatar" id="upload-image-two"/>
        <input type="file" name="myfiles" class="upload" id="myFileTwo" onchange="ajaxFileUploads('myFileTwo','imageTwo','upload-image-two')">
        <input type="hidden" class="imageTwo" id="imageTwo" <#if item.imageTwo?if_exists  > value="${item.imageTwo}"  <#else> value="/image/icon_addpic.png" </#if> />
      </div>
    </div>
  </div>

  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">图片三</label>
    <div class="layui-input-block">
      <div class="famous-upload-pic">
        <img  <#if item.imageThree?if_exists  >src="${item.imageThree}"<#else>src="${s.base}/image/icon_addpic.png"</#if> class="upload-avatar" id="upload-image-three"/>
        <input type="file" name="myfiles" class="upload" id="myFileThree" onchange="ajaxFileUploads('myFileThree','imageThree','upload-image-three')">
        <input type="hidden" class="imageThree" id="imageThree" <#if item.imageThree?if_exists  > value="${item.imageThree}"  <#else> value="/image/icon_addpic.png" </#if> />
      </div>
    </div>
  </div>

  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">简介</label>
    <div class="layui-input-block">
      <div id="editor">

      </div>
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <div class="layui-input-block">
      <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="btnSubmit">确定</button>
      <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary closeLay">取消</button>
    </div>
  </div>
</form>
<script type="text/javascript" src="${s.base}/js/layui/layui.js"></script>
<script type="text/javascript" src="${s.base}/js/wangEditor/wangEditor.js"></script>
<script type="text/javascript" src="${s.base}/js/base/item/itemUpdateOrSave.js"></script>
<script type="text/javascript" src="${s.base}/js/base/jquery-3.2.0.min.js"></script>
<script type="text/javascript" src="${s.base}/js/base/ajaxfileupload.js"></script>
<script>
    var E = window.wangEditor;
    var editor = new E('#editor');
    editor.customConfig.uploadFileName = 'myfiles';
    editor.customConfig.uploadImgServer = '/file/fileUploadEditor';
    editor.create();
    var itemDesc = '${item.itemDesc}';
    editor.txt.html(itemDesc);
</script>
</body>
</html>